<?php
namespace app\admin\validate;
use think\facade\Db;
use think\Validate;

class Admin extends Validate
{

    protected $rule=[
        'username'    =>'require|max:30|unique:admin',
//        'password'    =>'require|min:6',
        'role_id'    =>'require',
//        'admin_id'=>'require|number|checkId',
    ];
    protected $message = [
        'username.require'    => '请输入用户名',
        'username.max'    => '用户名最多30个字符',
        'username.unique'     => '已存在相同用户名',
//        'password.require'    => '请输入密码',
//        'password.min'    => '密码最少输入6位',
        'role_id.require'    => '请选择角色',
//        'admin_id.require'     => '缺少id',
//        'admin_id.number'      => '信息不存在',
//        'admin_id.checkId'      => '信息不存在',
    ];
    protected $scene = [
        'add' =>['username','role_id'],
        'edit'=>['username','role_id','admin_id'],
        'del' =>['admin_id'],
    ];

}